<template>
  <div class="filter-more">
    <div class="from_header">
      <el-form ref="form" label-width="120px">
        <el-form-item label="是否外协：">
          <el-select
            v-model="searchInfo.isAssist"
            clearable
            placeholder="请选择"
            @change="changeIsAssist"
          >
            <el-option
              v-for="item in completeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="检验员：">
          <el-input
            v-model="searchInfo.examiner"
            size="small"
            placeholder="请输入检验员"
          />
        </el-form-item>
        <el-form-item label="内部订单编号：">
          <el-input
            v-model="searchInfo.orderCode"
            size="small"
            placeholder="请输入内部订单编号"
          />
        </el-form-item>
        <el-form-item label="状态：">
          <el-select
            v-model="searchInfo.status"
            clearable
            placeholder="请选择"
          >
            <el-option
              v-for="item in completeStatusList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="供应商筛选：">
          <el-input
            v-model="searchInfo.manufacturer"
            size="small"
            placeholder="请输入供应商筛选"
          />
        </el-form-item>
        <el-form-item label="图号：">
          <el-input
            v-model="searchInfo.picCode"
            size="small"
            placeholder="请输入图号"
          />
        </el-form-item>
      </el-form>

      <div class="establish">
        <el-button
          type="primary"
          size="small"
          @click="selected"
        >查询</el-button
        >
        <el-button plain size="small" @click="reset">重置</el-button>
      </div>
    </div>
  </div>
</template>

<script>
// import { Message } from 'element-ui';

export default {
  model: {
    prop: 'searchInfo'
  },
  props: {
    isNosingle: {
      type: Boolean,
      default() {
        return false
      }
    },
    isOrderProduct: {
      type: Boolean,
      default() {
        return false
      }
    }
  },
  data() {
    return {
      completeStatusList: [
        {
          label: '未开始',
          value: '1'
        },
        {
          label: '已派单',
          value: '21'
        },
        {
          label: '已外协',
          value: '22'
        },
        {
          label: '已派单-已外协',
          value: '23'
        },
        {
          label: '供应商竣工',
          value: '24'
        },
        {
          label: '已收货',
          value: '25'
        },
        {
          label: '合格',
          value: '26'
        },
        {
          label: '不合格',
          value: '27'
        },
        {
          label: '生产中',
          value: '3'
        },
        {
          label: '待品检',
          value: '4'
        },
        {
          label: '报废',
          value: '41'
        },
        {
          label: '可维修',
          value: '42'
        },
        {
          label: '品检中',
          value: '5'
        },
        {
          label: '待入库',
          value: '51'
        },
        {
          label: '入库中',
          value: '6'
        },
        {
          label: '出库中',
          value: '7'
        },
        {
          label: '已完成',
          value: '8'
        }
      ],
      completeList: [
        {
          label: '否',
          value: '0'
        },
        {
          label: '是',
          value: '1'
        }
      ],
      searchInfo: {
        isAssist: '0',
        examiner: '',
        orderCode: '',
        status: '',
        picCode: '',
        manufacturer: ''
      }
    }
  },
  mounted() {},
  methods: {
    changeIsAssist(val) {
      this.searchInfo.examiner = ''
      this.searchInfo.orderCode = ''
      this.searchInfo.status = ''
      this.searchInfo.picCode = ''
      this.searchInfo.manufacturer = ''
      console.log(val)
      if (val == 0) {
        // 品检自制
        this.completeStatusList = [
          {
            label: '未开始',
            value: '1'
          },
          {
            label: '已派单',
            value: '21'
          },
          {
            label: '已外协',
            value: '22'
          },
          {
            label: '已派单-已外协',
            value: '23'
          },
          {
            label: '供应商竣工',
            value: '24'
          },
          {
            label: '已收货',
            value: '25'
          },
          {
            label: '合格',
            value: '26'
          },
          {
            label: '不合格',
            value: '27'
          },
          {
            label: '生产中',
            value: '3'
          },
          {
            label: '待品检',
            value: '4'
          },
          {
            label: '报废',
            value: '41'
          },
          {
            label: '可维修',
            value: '42'
          },
          {
            label: '品检中',
            value: '5'
          },
          {
            label: '待入库',
            value: '51'
          },
          {
            label: '入库中',
            value: '6'
          },
          {
            label: '出库中',
            value: '7'
          },
          {
            label: '已完成',
            value: '8'
          }
        ]
      } else if (val == 1) {
        // 外协
        this.completeStatusList = [
          {
            label: '已外协',
            value: '22'
          },
          {
            label: '已派单-已外协',
            value: '23'
          },
          {
            label: '供应商竣工',
            value: '24'
          },
          {
            label: '已收货',
            value: '25'
          },
          {
            label: '合格',
            value: '26'
          },
          {
            label: '不合格',
            value: '27'
          }
        ]
      }
      // this.$emit('changeIsAssist', val)
    },
    selected() {
      this.$emit('selected', this.searchInfo)
    },
    // 重置
    reset() {
      this.searchInfo = {
        isAssist: '0',
        examiner: '',
        orderCode: '',
        status: '',
        picCode: '',
        manufacturer: ''
      }
      this.selected()
    }
  }
}
</script>

<style scoped lang="scss">
.filter-more {
	// width: 90%;
	// margin: 0 auto;
	display: flex;
	flex-direction: column;
	// background: #ccc;
	// border: 1px solid #e8f4fd;
	// padding: 25px 15px;
	.from_header {
		width: 100%;
		height: 100%;

		.el-form-item {
			margin: 10px 30px;
		}

		.el-form {
			width: 100%;
			display: flex;
			flex-wrap: wrap;
		}
		/deep/ .el-form-item__content {
			display: flex;
		}
	}
	.establish {
		float: right;
	}
}
</style>
